feat: add Zig language support#70
Merged
Merged
Conversation
Contributor
Author
|
resolved merge conflicts on this one, hopefully good to go with the current state of main |
- Add tree-sitter-zig grammar for semantic parsing of .zig files - Register .zig extension in DEFAULT_INCLUDE file discovery - Add ZIG_SEMANTIC_NODES: function_declaration, test_declaration, struct/enum/union/opaque/error_set declarations - Add line_comment and doc_comment support via is_comment_node - Add native/queries/zig-calls.scm for call graph extraction - Wire Zig into CALL_GRAPH_LANGUAGES and CALL_GRAPH_SYMBOL_CHUNK_TYPES - Fix Windows path separator issue in src/native/index.ts isDevMode check - Update config test length for new DEFAULT_INCLUDE entry - Update README supported languages and default file patterns Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Helweg
reviewed
May 6, 2026
Owner
Helweg
left a comment
There was a problem hiding this comment.
Posting the verified Zig follow-ups from review.
…upport - Switch Zig comment detection from `line_comment | doc_comment` to `comment` (tree-sitter-zig emits all comments under a single node type, so doc comments were never attaching to semantic chunks) - Tag field-expression call pattern with `@method.call` so that std.debug.print-style calls are classified as MethodCall - Add dedicated `@import.name` / `@import` capture for builtin_function nodes with a string argument, promoting @import("std") from a generic builtin call to a proper import edge - Strengthen Zig tests: assert function_declaration / test_declaration chunk types, verify doc-comment attachment, and assert MethodCall and Import call types rather than no-crash checks Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
Author
|
Claude took a shot at trying to address your comments since I am far from a tree-sitter expert, but let me know if that is insufficient still. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds first-class Zig support to the indexer: tree-sitter semantic parsing, file-pattern discovery, and call-graph extraction for
.zigfiles.Changes
tree-sitter-ziggrammar dependency and wires it into the native parser registry.**/*.zigglob inDEFAULT_INCLUDEfor file discovery.function_declaration,test_declaration,struct_declaration,enum_declaration,union_declaration,opaque_declaration,error_set_declaration.line_comment,doc_comment.native/queries/zig-calls.scm— covers direct calls, method/field calls, and builtin calls (@import,@This, etc.).CALL_GRAPH_LANGUAGESandCALL_GRAPH_SYMBOL_CHUNK_TYPESinsrc/indexer/index.ts.tests/config.test.tsupdated for the newDEFAULT_INCLUDEentry count.Testing
tests/native.test.ts(function/struct declarations become chunks); call-graph tests intests/call-graph.test.ts(direct calls and@importbuiltins).npm run build)npm run typecheck)npm run test:run)npm run lint)Release Labels
feature)semver:minor)Related Issues
N/A.
Notes for reviewer
This PR and the Fortran PR both touch
CALL_GRAPH_LANGUAGESandCALL_GRAPH_SYMBOL_CHUNK_TYPESinsrc/indexer/index.ts. Whichever merges second will need a trivial conflict resolution to keep both languages in the lists.